<?php

/**
 * 说明:
 * User: wenqiang.yq@gmail.com
 * Date: 16-3-6
 * Time: 下午9:44
 */

include_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "ElasticSearch.php";

function create()
{
    $es = new \ElasticSearch\ElasticSearch("http://127.0.0.1:9200");
    $result = $es->index()->create("logstash-2015.05.19", 1, 2);
    print_r($result);
}

function delete()
{
    $es = new \ElasticSearch\ElasticSearch("http://127.0.0.1:9200");
    $result = $es->index()->delete("test");
    print_r($result);
}

function alias()
{
    $es = new \ElasticSearch\ElasticSearch("http://127.0.0.1:9200");
    $result = $es->index()->alias("server_log", "server_log_v1");
    print_r($result);
}

function aliasInfo()
{

    $es = new \ElasticSearch\ElasticSearch("http://127.0.0.1:9200");
    $result = $es->index()->aliasInfo("","server_log_v1");
    print_r($result);
}

function aliasTransfer(){

    $es = new \ElasticSearch\ElasticSearch("http://127.0.0.1:9200");
    $result = $es->index()->aliasTransfer("server_log_v1","server_log","system_log");
    print_r($result);
}

create();